const state = {
	themeType: 'light',
	statusBarHeight: 0,
	font: null,
	navColor: 'rgb(235,235,235)',
	background: 'rgb(239, 238, 238)',
	color1:"#cbcaca",
	color2:"#ffffff",
	fontSize: 38,
	lineHeight: 80
}

const mutations = {
	SET_THEMETYPE: (state, data) => {
		if (data) {
			uni.setStorage({
				data: data,
				key: 'themeType'
			})
			state.themeType = data
			return
		}
		state.themeType = state.themeType == 'dark' ? 'light' : 'dark'
		uni.setStorage({
			data: state.themeType,
			key: 'themeType'
		})
		//#ifdef APP
		plus.navigator.setStatusBarStyle(state.themeType == 'dark' ? 'light' : 'dark');
		//#endif
	},
	SET_STATUSBARHEIGHT: (state, data) => {
		state.statusBarHeight = data
	},
	SET_FONT: (state, data) => {
		state.font = data
		uni.setStorage({
			data: data,
			key: 'font'
		})
	},
	SET_NAVCOLOR: (state, data) => {
		state.navColor = data
		uni.setStorage({
			data: data,
			key: 'navColor'
		})
	},
	SET_COLOR1: (state, data) => {
		state.color1 = data
		uni.setStorage({
			data: data,
			key: 'color1'
		})
	},
	SET_COLOR2: (state, data) => {
		state.color2 = data
		uni.setStorage({
			data: data,
			key: 'color2'
		})
	},
	SET_BACKGROUND: (state, data) => {
		state.background = data
		uni.setStorage({
			data: data,
			key: 'background'
		})
	},
	SET_FONTSIZE: (state, data) => {
		state.fontSize = data
		uni.setStorage({
			data: data,
			key: 'fontSize'
		})
	},
	SET_LINEHEIGHT: (state, data) => {
		state.lineHeight = data
		uni.setStorage({
			data: data,
			key: 'lineHeight'
		})
	}
}

const actions = {
	// changeSetting({ commit }, data) {

	// }
}

export default {
	namespaced: true,
	state,
	mutations,
	actions
}
